Proxies
Getting Started
The following sections describe the basic usage of the Proxies API.
Deploy a proxy
After you define an API Instance and configure policies, you can deploy a proxy in Runtime Manager. The following examples show how to deploy to different targets:
To Deploy to CloudHub:
curl -X POST \
https://anypoint.mulesoft.com/proxies/xapi/v1/organizations/:organizationId/environments/:environmentId/apis/:apiId/deployments \
-H 'authorization: Bearer OMITTED' \
-H 'content-type: application/json' \
-d '{
"applicationName":"myCloudhubDeploy",
"gatewayVersion":"3.8.0",
"overwrite":false,
"type":"CH",
"environmentId":"<:environmentID>"
}'
To redeploy an application in Cloudhub, you can define the property overwrite:true
as shown the following example:
curl -X PUT \
https://anypoint.mulesoft.com/proxies/xapi/v1/organizations/:organizationId/environments/:environmentId/apis/:apiInstanceId/deployments/:deploymentId \
-H 'authorization: Bearer OMITTED' \
-H 'content-type: application/json' \
-d '{
"applicationName":"myCloudhubDeploy",
"gatewayVersion":"4.3.0",
"overwrite":true,
"type":"CH",
"environmentId":"<:environmentID>"
}'
To Deploy to a Hybrid Environment (either Mule 4, Flex Gateway, or Mule 3)
curl -X POST \
https://anypoint.mulesoft.com/proxies/xapi/v1/organizations/:organizationId/environments/:environmentId/apis/:apiInstanceId/deployments \
-H 'authorization: Bearer OMITTED' \
-H 'content-type: application/json' \
-d '{
"gatewayVersion":"3.9.0",
"targetId":<:targetId>,
"targetName":"Server Name",
"targetType":"server",
"type":"HY",
"environmentId":"<:environmentID>"
}'
The targetId
is the identifier that Runtime Manager provides for the particular Mule Server or Flex Gateway that you want to deploy to.
Deploy to RuntimeFabric
Get deployment targets with:
curl -X GET \
'https://anypoint.mulesoft.com/proxies/xapi/v1/organizations/:organizationId/providers/:providerId/runtime-fabric-deployment-targets?environmentId=:environmentId' \
-H 'Authorization: Bearer OMITTED' \
Deploy:
curl -X POST \
https://anypoint.mulesoft.com/proxies/xapi/v1/organizations/:organizationId/environments/:environmentId/apis/:apiId/deployments \
-H 'Authorization: Bearer OMITTED' \
-H 'Content-Type: application/json' \
-d '{
"type":"RF",
"name":"myRuntimeFabricDeploy",
"target": {
"targetId":<:targetId>,
"deploymentSettings": {
"runtimeVersion":<:runtimeVersion>
}
}
}'
To Deploy a Proxy to a Standalone Runtime
To deploy a proxy in a standalone Mule runtime, use this command:
curl -X GET \
https://anypoint.mulesoft.com/proxies/xapi/v1/organizations/:organizationId/environments/:environmentId/apis/:apiInstanceId/proxy \
-H 'authorization: Bearer OMITTED' \
-H 'content-type: application/json'
This will download a file for a mule application acting as a proxy for your API, which you can then deploy in a standalone Mule runtime as any other mule application.